package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CwShoppingCartMapper;
import com.ruoyi.system.domain.CwShoppingCart;
import com.ruoyi.system.service.ICwShoppingCartService;

/**
 * 购物车Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-30
 */
@Service
public class CwShoppingCartServiceImpl implements ICwShoppingCartService 
{
    @Autowired
    private CwShoppingCartMapper cwShoppingCartMapper;

    /**
     * 查询购物车
     * 
     * @param cartId 购物车主键
     * @return 购物车
     */
    @Override
    public CwShoppingCart selectCwShoppingCartByCartId(Long cartId)
    {
        return cwShoppingCartMapper.selectCwShoppingCartByCartId(cartId);
    }

    /**
     * 查询购物车列表
     * 
     * @param cwShoppingCart 购物车
     * @return 购物车
     */
    @Override
    public List<CwShoppingCart> selectCwShoppingCartList(CwShoppingCart cwShoppingCart)
    {
        return cwShoppingCartMapper.selectCwShoppingCartList(cwShoppingCart);
    }

    /**
     * 新增购物车
     * 
     * @param cwShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int insertCwShoppingCart(CwShoppingCart cwShoppingCart)
    {
        return cwShoppingCartMapper.insertCwShoppingCart(cwShoppingCart);
    }

    /**
     * 修改购物车
     * 
     * @param cwShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int updateCwShoppingCart(CwShoppingCart cwShoppingCart)
    {
        return cwShoppingCartMapper.updateCwShoppingCart(cwShoppingCart);
    }

    /**
     * 批量删除购物车
     * 
     * @param cartIds 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteCwShoppingCartByCartIds(Long[] cartIds)
    {
        return cwShoppingCartMapper.deleteCwShoppingCartByCartIds(cartIds);
    }

    /**
     * 删除购物车信息
     * 
     * @param cartId 购物车主键
     * @return 结果
     */
    @Override
    public int deleteCwShoppingCartByCartId(Long cartId)
    {
        return cwShoppingCartMapper.deleteCwShoppingCartByCartId(cartId);
    }
}
